class ExcelColumnTitle {
    public String convertToTitle(int columnNumber) {
        StringBuilder result = new StringBuilder();

        while (columnNumber > 0) {
            columnNumber--; // 使列号变为从 0 开始
            result.insert(0, (char) ('A' + columnNumber % 26)); // 取余并转换为字符
            columnNumber /= 26; // 进行除法运算，处理下一位
        }

        return result.toString();
    }

    public static void main(String[] args) {
        ExcelColumnTitle solution = new ExcelColumnTitle();

        // 测试
        System.out.println(solution.convertToTitle(1)); // 输出 A
        System.out.println(solution.convertToTitle(28)); // 输出 AB
        System.out.println(solution.convertToTitle(701)); // 输出 ZY
        System.out.println(solution.convertToTitle(2147483647)); // 输出 FXSHRXW
    }
}
